﻿using System;
using Character;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x0200020B RID: 523
public class HWearAcceChangeUI : MonoBehaviour
{
	// Token: 0x06000E5F RID: 3679 RVA: 0x0005A200 File Offset: 0x00058400
	private void Awake()
	{
		this.mainToggle.ActionAddListener(new UnityAction<bool>(this.OnChangeMainToggle));
		this.wearAll.onClick.AddListener(new UnityAction(this.ChangeAcceShow_All));
		this.wearHalf.onClick.AddListener(new UnityAction(this.ChangeAcceShow_Half));
		this.wearNude.onClick.AddListener(new UnityAction(this.ChangeWearShow_Nude));
		for (int i = 0; i < 14; i++)
		{
			WEAR_SHOW_TYPE id = (WEAR_SHOW_TYPE)i;
			this.wears[i].onClick.AddListener(delegate()
			{
				this.ChangeWearShow(id);
			});
		}
		this.acceOn.onClick.AddListener(new UnityAction(this.ChangeAcceShow_AllOn));
		this.acceOff.onClick.AddListener(new UnityAction(this.ChangeAcceShow_AllOff));
		for (int j = 0; j < 10; j++)
		{
			int id = j;
			this.acces[j].onClick.AddListener(delegate()
			{
				this.ChangeAcceShow(id);
			});
		}
		this.hideableRoot.SetActive(false);
		this.switchRoot.action.AddListener(new UnityAction<int>(this.SwitchFemale));
	}

	// Token: 0x06000E60 RID: 3680 RVA: 0x0005A364 File Offset: 0x00058564
	public void Setup(H_Scene h_scene)
	{
		this.h_scene = h_scene;
		this.SetNameUI();
		this.switchRoot.Value = 0;
		this.SwitchFemale(0);
	}

	// Token: 0x06000E61 RID: 3681 RVA: 0x0005A388 File Offset: 0x00058588
	private void SetNameUI()
	{
		Female female = this.h_scene.mainMembers.GetFemale(0);
		Female female2 = null;
		if (this.h_scene.visitor != null)
		{
			female2 = (this.h_scene.visitor.GetHuman() as Female);
		}
		string text = Female.HeroineName(female.HeroineID);
		this.switchFemale.SetText(text, text);
		this.switchRoot.gameObject.SetActive(female2 != null);
		if (this.h_scene.visitor != null && this.h_scene.visitor.IsFemale())
		{
			string text2 = Female.HeroineName(female2.HeroineID);
			this.switchVisitor.SetText(text2, text2);
		}
	}

	// Token: 0x06000E62 RID: 3682 RVA: 0x0005A440 File Offset: 0x00058640
	public void SwitchedFemaleVisitor()
	{
		this.SetNameUI();
		this.SwitchFemale(0);
	}

	// Token: 0x06000E63 RID: 3683 RVA: 0x0005A450 File Offset: 0x00058650
	private void SwitchFemale(int no)
	{
		if (no == 0)
		{
			this.female = this.h_scene.mainMembers.GetFemale(0);
		}
		else if (no == 1)
		{
			this.female = (this.h_scene.visitor.GetHuman() as Female);
		}
		this.CheckShowUI();
	}

	// Token: 0x06000E64 RID: 3684 RVA: 0x0005A4A8 File Offset: 0x000586A8
	public void CheckShowUI()
	{
		for (int i = 0; i < 14; i++)
		{
			WEAR_SHOW_TYPE type = (WEAR_SHOW_TYPE)i;
			this.wears[i].gameObject.SetActive(this.female.wears.IsEquiped(this.female.customParam, type));
		}
		for (int j = 0; j < 10; j++)
		{
			this.acces[j].gameObject.SetActive(this.female.accessories.IsAttachedAccessory(j));
		}
	}

	// Token: 0x06000E65 RID: 3685 RVA: 0x0005A530 File Offset: 0x00058730
	private void OnChangeMainToggle(bool change)
	{
		this.hideableRoot.SetActive(change);
		if (change)
		{
			this.CheckShowUI();
		}
	}

	// Token: 0x06000E66 RID: 3686 RVA: 0x0005A54C File Offset: 0x0005874C
	private void ChangeAcceShow_All()
	{
		for (WEAR_SHOW_TYPE wear_SHOW_TYPE = WEAR_SHOW_TYPE.TOPUPPER; wear_SHOW_TYPE < WEAR_SHOW_TYPE.SHOES; wear_SHOW_TYPE++)
		{
			this.female.wears.ChangeShow(wear_SHOW_TYPE, WEAR_SHOW.ALL);
		}
		this.female.CheckShow();
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E67 RID: 3687 RVA: 0x0005A590 File Offset: 0x00058790
	private void ChangeAcceShow_Half()
	{
		for (WEAR_SHOW_TYPE wear_SHOW_TYPE = WEAR_SHOW_TYPE.TOPUPPER; wear_SHOW_TYPE < WEAR_SHOW_TYPE.SHOES; wear_SHOW_TYPE++)
		{
			this.female.wears.ChangeShow(wear_SHOW_TYPE, WEAR_SHOW.HALF);
		}
		this.female.CheckShow();
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E68 RID: 3688 RVA: 0x0005A5D4 File Offset: 0x000587D4
	private void ChangeWearShow_Nude()
	{
		for (WEAR_SHOW_TYPE wear_SHOW_TYPE = WEAR_SHOW_TYPE.TOPUPPER; wear_SHOW_TYPE < WEAR_SHOW_TYPE.SHOES; wear_SHOW_TYPE++)
		{
			this.female.wears.ChangeShow(wear_SHOW_TYPE, WEAR_SHOW.HIDE);
		}
		this.female.CheckShow();
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E69 RID: 3689 RVA: 0x0005A618 File Offset: 0x00058818
	private void ChangeWearShow(WEAR_SHOW_TYPE type)
	{
		WEAR_SHOW show = this.female.wears.GetShow(type, true);
		WEAR_SHOW show2 = this.female.wears.GetShow(type, false);
		if (show == show2)
		{
			WEAR_SHOW show3 = this.Next(type, show2);
			this.female.wears.ChangeShow(type, show3);
			this.female.CheckShow();
		}
		else
		{
			WEAR_SHOW_TYPE wearShowTypePair = Wears.GetWearShowTypePair(type);
			this.female.wears.ChangeShow(type, WEAR_SHOW.ALL);
			this.female.wears.ChangeShow(wearShowTypePair, WEAR_SHOW.ALL);
			this.female.CheckShow();
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E6A RID: 3690 RVA: 0x0005A6BC File Offset: 0x000588BC
	private WEAR_SHOW Next(WEAR_SHOW_TYPE type, WEAR_SHOW now)
	{
		int wearShowNum = this.female.wears.GetWearShowNum(type);
		if (wearShowNum == 2)
		{
			int num = ((int)now + 1) % 3;
			now = (WEAR_SHOW)num;
		}
		else if (wearShowNum == 1)
		{
			now = ((now != WEAR_SHOW.ALL) ? WEAR_SHOW.ALL : WEAR_SHOW.HIDE);
		}
		return now;
	}

	// Token: 0x06000E6B RID: 3691 RVA: 0x0005A708 File Offset: 0x00058908
	private void ChangeAcceShow_AllOn()
	{
		for (int i = 0; i < 10; i++)
		{
			this.female.accessories.SetShow(i, true);
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E6C RID: 3692 RVA: 0x0005A740 File Offset: 0x00058940
	private void ChangeAcceShow_AllOff()
	{
		for (int i = 0; i < 10; i++)
		{
			this.female.accessories.SetShow(i, false);
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06000E6D RID: 3693 RVA: 0x0005A778 File Offset: 0x00058978
	private void ChangeAcceShow(int id)
	{
		bool show = !this.female.accessories.GetShow(id);
		this.female.accessories.SetShow(id, show);
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x04000ED2 RID: 3794
	[SerializeField]
	private ToggleButton mainToggle;

	// Token: 0x04000ED3 RID: 3795
	[SerializeField]
	private GameObject hideableRoot;

	// Token: 0x04000ED4 RID: 3796
	[SerializeField]
	private Button wearAll;

	// Token: 0x04000ED5 RID: 3797
	[SerializeField]
	private Button wearHalf;

	// Token: 0x04000ED6 RID: 3798
	[SerializeField]
	private Button wearNude;

	// Token: 0x04000ED7 RID: 3799
	[SerializeField]
	private Button[] wears = new Button[14];

	// Token: 0x04000ED8 RID: 3800
	[SerializeField]
	private Button acceOn;

	// Token: 0x04000ED9 RID: 3801
	[SerializeField]
	private Button acceOff;

	// Token: 0x04000EDA RID: 3802
	[SerializeField]
	private Button[] acces = new Button[10];

	// Token: 0x04000EDB RID: 3803
	[SerializeField]
	private RadioButtonGroup switchRoot;

	// Token: 0x04000EDC RID: 3804
	[SerializeField]
	private ToggleButton switchFemale;

	// Token: 0x04000EDD RID: 3805
	[SerializeField]
	private ToggleButton switchVisitor;

	// Token: 0x04000EDE RID: 3806
	private bool invoke = true;

	// Token: 0x04000EDF RID: 3807
	private H_Scene h_scene;

	// Token: 0x04000EE0 RID: 3808
	private Female female;
}
